$(document).ready(function(){
	copyDelivery($('#UserDeliveryAsBilling').attr('checked'));
	$('#UserDeliveryAsBilling').bind('change', function (event) {
		copyDelivery($(this).attr('checked'));
	});
});

$(function() {
	$( '#tabs' ).tabs();
	$( '#tabs-related' ).tabs();
});

function copyDelivery(checked){
	if(checked){
		$('#UserDeliveryFirstName').attr({'value':$('#UserFirstName').attr('value'),'disabled':'disabled'});			
		$('#UserDeliveryLastName').attr({'value':$('#UserLastName').attr('value'),'disabled':'disabled'});
		$('#UserDeliveryAddress1').attr({'value':$('#UserAddress1').attr('value'),'disabled':'disabled'});
		$('#UserDeliveryAddress2').attr({'value':$('#UserAddress2').attr('value'),'disabled':'disabled'});
		$('#UserDeliveryAddress3').attr({'value':$('#UserAddress3').attr('value'),'disabled':'disabled'});
		$('#UserDeliveryAddress4').attr({'value':$('#UserAddress4').attr('value'),'disabled':'disabled'});
		$('#UserDeliveryAddress5').attr({'value':$('#UserAddress5').attr('value'),'disabled':'disabled'});
	}else{
		$('#UserDeliveryFirstName').attr('disabled',false);
		$('#UserDeliveryLastName').attr('disabled',false);
		$('#UserDeliveryAddress1').attr('disabled',false);
		$('#UserDeliveryAddress2').attr('disabled',false);
		$('#UserDeliveryAddress3').attr('disabled',false);
		$('#UserDeliveryAddress4').attr('disabled',false);
		$('#UserDeliveryAddress5').attr('disabled',false);
	}		
}